package com.rajeshDyadav.pattern;

import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.validator.routines.EmailValidator;
import org.apache.commons.validator.routines.DateValidator;

public class PatternTest {
    
    public static void main(String[] args) {
	String regexEmailId = "[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$";	
	String regexPanNo = "[A-Z]{5}[0-9]{4}[A-Z]{1}";
	
	String emailId = "RAJ.EMB@GMAIL.COM";
	String panNo = "ABCDE1234F";
	
//	Pattern pattern = Pattern.compile(regexEmailId);
//	Matcher matcher = pattern.matcher(emailId);
//	if(matcher.matches()) {
//	    System.out.println("Matched");
//	}
	
	System.out.println("PanNo ..> " + Pattern.matches(regexPanNo, panNo));
	System.out.println("EmailId ..> " + Pattern.matches(regexEmailId, emailId));
	
	EmailValidator emailValidator = EmailValidator.getInstance();
	System.out.println(emailValidator.isValid(emailId));
	
	
	DateValidator dateValidator = DateValidator.getInstance();
	Date a = new Date();
	Date b = new Date();
	System.out.println(dateValidator.compareDates(a, b, null));
	
    }
}
